package com.vitas.coin.ui.act

import android.annotation.SuppressLint
import android.os.Bundle
import android.view.ViewGroup
import android.widget.ProgressBar
import android.widget.TextView
import com.blankj.utilcode.util.BarUtils
import com.snap.base.base.BaseAdSplashAct
import com.snap.base.ktx.isConfigGoBuy
import com.snap.base.util.BaseUtil
import com.snap.util.log.SLog
import com.snap.util.startAct
import com.vitas.coin.R

class SplashAct : BaseAdSplashAct() {

    private var progressBar: ProgressBar? = null
    private var progressTV: TextView? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        progressBar = findViewById(R.id.pb)
        progressTV = findViewById(R.id.tv_pb)
    }

    @SuppressLint("SetTextI18n")
    override fun updateProgress(progress: Int) {
        progressBar?.progress = progress
        progressTV?.text = "加载中$progress%"
    }


    @SuppressLint("WrongViewCast")
    override fun getAdSplash(): ViewGroup {
        return findViewById(R.id.parent_sp)
    }

    override fun getLayoutId(): Int {
        return R.layout.act_splash
    }

    override fun startMainAct() {
        BarUtils.transparentStatusBar(this)
        BarUtils.setStatusBarLightMode(this,true)

        startAct(MainAct::class.java)
        if (BaseUtil.isConfigGoBuy()) {
            startAct(BuyAct::class.java)
        }
        finish()
    }
}